import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/emsapi/blade-ems/plan/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

//检查调度计划状态，根据返回状态，前端提示 是否覆盖原来任务，还是禁止重复生成任务，或者直接生成任务
export const checkTaskByPlanId = (id) => {
  return request({
    url: '/emsapi/blade-ems/plan/checktaskbyid',
    method: 'post',
    params: {
      'planId':id
    }
  })
}

//根据调度计划生成出车任务-单个
export const createTaskByPlanId = (id) => {
  return request({
    url: '/emsapi/blade-ems/plan/createtaskbyid',
    method: 'post',
    params: {
      'planId':id
    }
  })
}

// 根据调度计划批量删除出车任务及明细-单个
export const deleteTaskByPlanId = (id) => {
  return request({
    url: '/emsapi/blade-ems/plan/deletetaskbyid',
    method: 'post',
    params: {
      'planId':id
    }
  })
}

//复制调度计划
export const copyPlan = (fromDate,toDate) => {
  return request({
    url: '/emsapi/blade-ems/plan/copy',
    method: 'post',
    params: {
      fromDate,toDate
    }
  })
}




export const getDetail = (id) => {
  return request({
    url: '/emsapi/blade-ems/plan/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/emsapi/blade-ems/plan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/emsapi/blade-ems/plan/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/emsapi/blade-ems/plan/submit',
    method: 'post',
    data: row
  })
}

